Completed
Push — master ( 1b4532...54964d )
by Andres
01:14
created

angular.service(ꞌstateꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 5
rs 9.4285
nop 0
1
'use strict';
2
3
angular
4
  .module('game')
5
  .service('state', [function() {
6
    this.currentElement = 'H';
7
    this.hoverElement = '';
8
    this.export = '';
9
    this.player = {};
10
    this.loading = true;
11
    let updateFunctions = [];
12
13
    this.init = function() {
14
      this.currentElement = 'H';
15
      this.hoverElement = '';
16
      this.export = '';
17
    };
18
19
    this.registerUpdate = function(func){
20
      updateFunctions.push(func);
21
    };
22
23
    this.update = function(player){
24
      for(let func of updateFunctions){
25
        func(player);
26
      }
27
    };
28
  }]);
29